<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateShipmentTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('shipment', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->char('code', 12)->comment('出货单号');
            $table->unsignedBigInteger('express_id')->comment('快递公司');
            $table->integer('count')->default(0)->comment('订单个数');
            $table->double('weight', 19, 3)->default(0)->comment('毛重');
            $table->double('net_weight', 19, 3)->default(0)->comment('净重');
            $table->double('price', 19, 3)->default(0)->comment('价格');
            $table->tinyInteger('status')->default(0)->comment('状态: 0 草稿 1 出货');
            $table->timestamp('shipment_at')->nullable()->comment('出货时间');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('shipment');
    }
}
